package cn.witsky.rtp2ws.util;

public class StackUtil {
    public static String printCallStatck() {
    	String threadName=Thread.currentThread().getName();
    	if(!threadName.startsWith("rtp2ws-Netty-UDP-listener-")) {
    		return "";
    	}
        Throwable ex = new Throwable();
        StackTraceElement[] stackElements = ex.getStackTrace();
        StringBuilder stackLog=new StringBuilder("");
        if (stackElements != null) {
            for (int i = 0; i < stackElements.length; i++) {
            	stackLog.append("\r\n");
            	stackLog.append("----------").append("fileName:").append(stackElements[i].getFileName()).append(" ");
            	stackLog.append("----------").append("className:").append(stackElements[i].getClassName()).append(" ");
            	stackLog.append("----------").append("methodName:").append(stackElements[i].getMethodName()).append(" ");
            	stackLog.append("----------").append("lineNumber:").append(stackElements[i].getLineNumber());
            }
        }
        return stackLog.toString();
    }
}
